<template lang="pug">
  ModuleWrapper(title="农药、兽药经营许可" flex="1")
    .chart-wrap(ref="chart")
</template>

<script>
export default {
  name: "ModulePopulation",
  data() {
    return {
      chart: null,
      data: [
        {
          label: '总人口',
          value: 0,
        },
        {
          label: '农业人口',
          value: 0,
        },
        {
          label: '新型职业农民',
          value: 0,
        },
        {
          label: '产业工人',
          value: 0,
        },
      ]
    }
  },
  methods: {
    renderChart() {
      this.chart = this.$echarts.init(this.$refs['chart']);
      this.chart.setOption({
        color: ['#1860d0', '#45c761', '#1bd8bb', '#8ad10c',],
        legend: {
          textStyle: {
            color: '#ccc'
          }
        },
        xAxis: {
          type: 'category',
          data: ['2016', '2017', '2018', '2019', '2020'],
          splitLine: false
        },
        yAxis: {
          type: 'value',
          splitLine: false
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          top: '30%',
          containLabel: true
        },
        series: [
          {
            name: "动物防疫条件合格证",
            data: [18, 20, 12, 2, 5],
            type: 'bar',
			label:{
				show:true,
				position:"top",
				textStyle:{
					color:"#fff"
				}
			}
          },
          {
            name: "农药经营许可证",
            data: [10, 8, 19, 28, 5],
            type: 'bar',
			label:{
				show:true,
				position:"top",
				textStyle:{
					color:"#fff"
				}
			}
          },
          {
            name: "其他许可",
            data: [0, 0, 0, 1, 6],
            type: 'bar',
			label:{
				show:true,
				position:"top",
				textStyle:{
					color:"#fff"
				}
			}
          }
        ]
      });
    },
  },
  mounted() {
    this.$nextTick(() => {
      this.renderChart();
    });
  }
}
</script>

<style lang="scss" scoped>
.module{
  display: flex;
  flex-direction: column;
  .chart-wrap{
    flex: 1;
  }
}
</style>
